package com.study_security.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.study_security.dto.MemberDTO;
import com.study_security.dto.ProjectDTO;
import com.study_security.entity.Member;
import com.study_security.dto.ProjectMembersDTO;
import com.study_security.entity.ProjectMember;
import com.study_security.mapper.MemberMapper;
import com.study_security.service.MemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> implements MemberService {
    @Autowired
    private MemberMapper memberMapper;

    @Override
    public List<MemberDTO> getProjectMembersAndTasks(String projectName) {
        return memberMapper.selectProjectMembersAndTasks(projectName);
    }
    @Override
    public List<MemberDTO> getMembersByProjectId(Long projectId) {
        return memberMapper.selectMembersByProjectId(projectId);
    }

    // 新增方法
    @Override
    public List<ProjectDTO> getUserProjects(Long userId) {
        return memberMapper.selectUserProjects(userId);
    }

    /**
     * 获得所有的成员列表
     * @return 成员列表
     */
    @Override
    public List<MemberDTO> getAllMembers() {
        return memberMapper.selectAllMember();
    }


}
